﻿#region using statements

using System.Collections.Generic;

using AeonOfStrifeDatatypes.Combat;
using AeonOfStrifeDatatypes.Units;

#endregion

namespace AeonOfStrife.Objects.Units
{
	public struct UnitStats
	{
		public readonly DamageValues m_baseDefense;

		public readonly int m_blockAttackRate;

		public readonly DamageValues m_bonusDefense;

		public readonly int m_counterAttackRate;

		public readonly int m_criticalDamageRate;

		public readonly int m_dodgeAttackRate;

		public readonly int m_attackRange;

		public readonly int m_hpIncreasePerUpgrade;

		public readonly int m_hpMax;

		public readonly int m_hpRegenPerSecond;

		public readonly List<AttackInfo> m_lAttacks;

		public readonly int m_moveSpeedIncreasePerUpgrade;

		public readonly int m_moveSpeedMax;

		public readonly int m_parryAttackRate;

		public AnimationInfo m_idleAnimation;

		public AnimationInfo m_runAnimation;

		internal UnitStats(UnitStatsXMLReader p_stats) {
			m_hpMax = p_stats.HpMax;
			m_hpIncreasePerUpgrade = p_stats.HpIncreasePerUpgrade;
			m_hpRegenPerSecond = p_stats.HpRegenPerSecond;
			m_moveSpeedMax = p_stats.MoveSpeedMax;
			m_moveSpeedIncreasePerUpgrade = p_stats.MoveSpeedIncreasePerUpgrade;
			m_baseDefense = p_stats.BaseDefense;
			m_bonusDefense = p_stats.BonusDefense;
			m_criticalDamageRate = p_stats.CriticalDamageRate;
			m_counterAttackRate = p_stats.CounterAttackRate;
			m_dodgeAttackRate = p_stats.DodgeAttackRate;
			m_parryAttackRate = p_stats.ParryAttackRate;
			m_blockAttackRate = p_stats.BlockAttackRate;
			m_attackRange = p_stats.AttackRange;
			m_idleAnimation = new AnimationInfo(p_stats.Idle);
			m_runAnimation = new AnimationInfo(p_stats.Run);
			m_lAttacks = new List<AttackInfo>();
			foreach(var attack in p_stats.Attacks) {
				m_lAttacks.Add(new AttackInfo(attack));
			}
		}
	}
}